import greenfoot.*;  // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)

/**
 * Write a description of class Vida here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class Vida extends Actor
{
    private static GreenfootImage[] images;
    int v=100;
    public Vida(){
     initializeImages();
     setImage(images[0]);
    }  
    
    public synchronized static void initializeImages() 
    {
        if(images == null) {
            images = new GreenfootImage[3];
            for (int i = 0; i < 3; i++)
            {
                images[i] = new GreenfootImage("life" + (i+1) + ".png");
            }
        }
    }
    private void updateImage()
    {
        if(v>51)
            setImage(images[0]);
        else
            if(v>20)
            setImage(images[1]);
            else
            setImage(images[2]);
    }
    public void getvid(int vid){
        v=vid;
        updateImage();
    }
}
